package com.example.fragment;

import com.example.activity.FloorActivity;
import com.example.activity.JsonEntrance;
import com.example.activity.RoomActivity;
import com.example.activity.TestDeviceActivity;
import com.example.drawer.MainActivity;
import com.example.drawer.R;

import android.app.Activity;
import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

public class SceneFragment extends Fragment {
	private Button button_floor,button_room,button_device;
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		View view = inflater.inflate(R.layout.scene_fargment, null);
		
		button_floor = (Button)view.findViewById(R.id.button_floor);
		button_room = (Button)view.findViewById(R.id.button_room);
		button_device = (Button)view.findViewById(R.id.button_device);
		button_floor.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(getActivity(),FloorActivity.class);
				startActivity(intent);				
			}
		});
		
		button_room.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(getActivity(),RoomActivity.class);
				startActivity(intent);
				
			}
		});
		
        button_device.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(getActivity(),TestDeviceActivity.class);
				startActivity(intent);
				
			}
		});
		
		return view;
	}
	
	public void onAttach(Activity activity) {
		// TODO Auto-generated method stub
		super.onAttach(activity);
		((MainActivity) activity).onSectionAttached(1); 
	}
	

}
